home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 January / PC Plus Super CD No55a (PCP-147A-1-99) (Disc 1) (1998).iso / linux / developers / visualtcl / windows / vtcl / lib / console.tcl < prev    next >
Encoding:
Text File  |  1997-05-27  |  2.9 KB  |  81 lines

  1. ##############################################################################
  2. # $Id: console.tcl,v 1.5 1997/05/28 01:43:01 stewart Exp $
  3. #
  4. # console.tcl - console procedures
  5. #
  6. # Copyright (C) 1996-1997 Stewart Allen
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License
  10. # as published by the Free Software Foundation; either version 2
  11. # of the License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22. ##############################################################################
  23. #
  24.  
  25. proc vTcl:show_console {} {
  26.     global vTcl tcl_platform
  27.     if {$vTcl(console) == 1} {
  28.         console show
  29.     } else {
  30.         Window show .vTcl.con
  31.     }
  32. }
  33.  
  34. proc vTclWindow.vTcl.con {args} {
  35.     set base .vTcl.con
  36.     if {[winfo exists .vTcl.con]} {
  37.         wm deiconify .vTcl.con; return
  38.     }
  39.     toplevel .vTcl.con -class vTcl
  40.     wm transient .vTcl.con .vTcl
  41.     wm minsize .vTcl.con 375 80
  42.     wm title .vTcl.con "Command Console"
  43.     frame .vTcl.con.fra5 \
  44.         -height 30 -width 30 
  45.     pack .vTcl.con.fra5 \
  46.         -anchor center -expand 1 -fill both -ipadx 0 -ipady 0 -padx 2 -pady 2 \
  47.         -side top 
  48.     text .vTcl.con.fra5.tex7 \
  49.         -highlightthickness 0 -state disabled -width 50 -height 6 \
  50.         -yscrollcommand {.vTcl.con.fra5.scr8 set} 
  51.     pack .vTcl.con.fra5.tex7 \
  52.         -anchor center -expand 1 -fill both -ipadx 0 -ipady 0 -padx 0 -pady 0 \
  53.         -side left 
  54.     scrollbar .vTcl.con.fra5.scr8 \
  55.         -command {.vTcl.con.fra5.tex7 yview} -highlightthickness 0
  56.     pack .vTcl.con.fra5.scr8 \
  57.         -anchor center -expand 0 -fill y -ipadx 0 -ipady 0 -padx 0 -pady 0 \
  58.         -side right 
  59.     frame .vTcl.con.fra6 \
  60.         -height 30 -width 30 
  61.     pack .vTcl.con.fra6 \
  62.         -anchor center -expand 0 -fill both -ipadx 0 -ipady 0 -padx 0 -pady 0 \
  63.         -side top 
  64.     entry .vTcl.con.fra6.ent10 \
  65.         -highlightthickness 0 
  66.     pack .vTcl.con.fra6.ent10 \
  67.         -anchor center -expand 0 -fill x -ipadx 0 -ipady 0 -padx 2 -pady 2 \
  68.         -side top 
  69.     bind .vTcl.con.fra6.ent10 <Key-Return> {
  70.         .vTcl.con.fra5.tex7 insert end "\n[.vTcl.con.fra6.ent10 get]"
  71.         if { [catch [.vTcl.con.fra6.ent10 get] vTcl(err)] == 1 } {
  72.             .vTcl.con.fra5.tex7 conf -state normal
  73.             .vTcl.con.fra5.tex7 insert end "\n$vTcl(err)"
  74.             .vTcl.con.fra5.tex7 conf -state disabled
  75.             .vTcl.con.fra5.tex7 yview end
  76.         }
  77.         .vTcl.con.fra6.ent10 delete 0 end
  78.     }
  79. }
  80.  
  81.